<?php
/**
 * @智库类
 * 1、智库列表
 * 2、智库详情
 * 
 */
namespace app\tank\controller;
use app\common\controller\HomeCommon;
class Index extends HomeCommon
{
	public function __construct(){
		
		parent::__construct();
		
	
	}
	
	
    /**
     * 获得政策列表
     */
    public function get_policy(){
    	$where=" 1=1 and status=1  ";
    	
    	
    	$keywords=request()->param('keywords','','trim');
    	if(!empty($keywords)){
    		$where.=" and policy_name like %$keywords% ";
    	}
    	
    	$industry_id=request()->param('industry_id',0,'intval');
    	if(!empty($id)){
    		$where.=" and industry_id = $industry_id ";
    	}
    	
    	
    	$city_id=request()->param('city_id',0,'intval');
    	if(!empty($id)){
    		$where.=" and (province_id=$city_id or city_id=$city_id or area_id=$city_id ) ";
    	}
    	
    	
    
    	
    	$field="policy_name,accept_time,content,about_files,files,create_time,identification";
    	$model=\think\Loader::model('Policy');
    	
    	$listobj=$model->get_list($field,$where);
    	
    	return json(['errcode'=>'0','msg'=>lang('Get success'),'data'=>$listobj]);
    }
    /**
     * 获得政策详情
     */
    public function get_policy_info(){
    	$where['status']=['=',1];
    	
    	
    	$identification=request()->param('identification','','trim');
    	
    	if(!empty($identification)){
    		$where['identification']=['=', $identification];
    	}else{
    		return json(['errcode'=>'-1','msg'=>lang('param error'),'data'=>[]]);
    	}
    	
    	
    	
    	$field="policy_name,accept_time,content,about_files,files,create_time,identification";
    	$model=\think\Loader::model('Policy');
    	
    	$listobj=$model->get_detail($field,$where);
    	
    	return json(['errcode'=>'0','msg'=>lang('Get success'),'data'=>$listobj]);
    }
}
